package com.yum.Iterator.Iterable;

import com.yum.Comsumer.YComsumer;

import java.util.Iterator;

public interface YIterable<T> extends Iterable<T> {

    Iterator<T> iterator();

    default void forEach(YComsumer<T> action){
        if(action == null){
            throw new NullPointerException();
        }
        for(T t : this){
            action.accept(t);
        }

    }

}
